import axios from 'axios'
import qs from 'qs'


let baseUrl1 = 'https://ra.bsedu.com/ra-prod-api'
let baseUrl2 = 'https://tk.bsedu.com/tiku-prod-api'
let baseUrl = 'https://omr.bsedu.com/api'
let baseUrl3 = 'https://scan.bsedu.com'
let baseUrl4 = 'https://ra-api.bsedu.com/'
if (process.env.NODE_ENV != "production") {
  baseUrl1 = 'https://test-ra.bsedu.com/ra-prod-api'
  baseUrl2 = 'https://test-tk.bsedu.com/tiku-prod-api'
  baseUrl = 'https://test-omr.bsedu.com/api'
  baseUrl3 = 'https://test-scan.bsedu.com'
  baseUrl4 = 'https://test-ra-api.bsedu.com/'
}


// 封装 GET 请求
export function get(url, params = {}, config = {}) {
  return axios({
    url: baseUrl + url,
    method: 'get',
    params,
    ...config,
  })
}

// 封装 POST 请求
export function post(url, data = {}, config = {}) {
  return axios({
    url: baseUrl + url,
    method: 'post',
    data,
    ...config,
  })
}

export function postscan(url, data = {}, config = {}) {
  return axios({
    url: baseUrl3 + url,
    method: 'post',
    data,
    ...config,
  })
}

// 封装 DELETE 请求
export function del(url, data = {}, config = {}) {
  return axios({
    url: baseUrl + url,
    method: 'delete',
    data,
    ...config,
  })
}
export function dele(url, params = {}, config = {}) {
  return axios({
    url: baseUrl + url,
    method: 'delete',
    params,
    ...config,
  })
}

// 封装 PUT 请求
export function put(url, data = {}) {
  return axios({
    url: baseUrl + url,
    method: 'put',
    data,
  })
}
// //手机验证
export function analsisget(url, params = {}, config = {}) {
  return axios({
    url: baseUrl1 + url,
    method: 'get',
    params,
    ...config,
  })
}
export function questionlist(url, data = {}, config = {}) {
  return axios({
    url: baseUrl2 + url,
    method: 'post',
    data,
    ...config,
  })
}
export function questionlistuuid(url, params = {}, config = {}) {
  return axios({
    url: baseUrl3 + url,
    method: 'get',
    params,
    ...config,
  })
}
export function questionlistscoreuuid(url, params = {}, config = {}) {
  return axios({
    url: baseUrl1 + url,
    method: 'get',
    params,
    ...config,
  })
}

export function getanalysis(url, params = {}, config = {}) {
  return axios({
    url: baseUrl4 + url,
    method: 'get',
    params,
    ...config,
  })
}
export function postanalysis(url, data = {}, config = {}) {
  return axios({
    url: baseUrl4 + url,
    method: 'post',
    data,
    ...config,
  })
}




// export function getScoreOverview (url, params = {}, config = {}) {
//   return axios({
//     url: baseUrl4 + url,
//     method: 'get',
//     params,
//     ...config,
//   })
// }